from rest_framework import serializers


# 用户表
class Userser(serializers.Serializer):
    name = serializers.CharField(max_length=200)
    password = serializers.CharField(max_length=200)
    id = serializers.IntegerField()
    class Meta:
        db_table = 'user'

# 产品表
class Goodser(serializers.Serializer):
    name = serializers.CharField(max_length=200)
    img = serializers.ImageField()
    price = serializers.DecimalField(max_digits=10,decimal_places=2)
    id = serializers.IntegerField()
    count = serializers.IntegerField()
    class Meta:
        db_table = 'good'
# 详情表
class Detailser(serializers.Serializer):
    uid = Userser()
    gid = Goodser()
    count = serializers.CharField(max_length=200)
    id = serializers.IntegerField()
    class Meta:
        db_table = 'detail'


# 订单表
class Dingser(serializers.Serializer):
    id = serializers.IntegerField()
    uid = Userser()
    gid = Goodser()
    did = Detailser()
    class Meta:
        db_table = 'ding'


